<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2017/8/21
 * Time: 16:46
 */

namespace app\common\model;

use traits\model\SoftDelete;

class User extends BaseModel
{
    protected $table = 'ng_users';

    protected $createTime = 'created_at';
    protected $updateTime = 'updated_at';
    protected $autoWriteTimestamp = 'datetime';

    use SoftDelete;
    protected $deleteTime = 'deleted_at';

    protected $hidden = [
        'password',
        'email_code',
        'created_at',
        'updated_at',
        'deleted_at'
    ];

    public function roles()
    {
        return $this->hasMany('RoleUser', 'user_id', 'id');
    }
    
    public function image()
    {
        return $this->hasOne('Image', 'id', 'image_id');
    }

}